package com.xxx.modules.sys.controller;

import com.xxx.common.utils.R;
import com.xxx.modules.sys.service.UserTextCollectionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**文章收藏 Controller
 * Created by ChenXuefei on 2017/10/17.
 */
@RestController
@Slf4j
public class SysUserTextCollectionController {

    @Autowired
    private UserTextCollectionService userTextCollectionService;

    @RequestMapping("sys/user/collection/add")
    public R addUserAttention(String collectionId, String textId){
        userTextCollectionService.addUserTextCollection(collectionId,textId);
        log.debug("【"+collectionId+" 收藏文章 "+textId+"】");
        return R.ok();
    }

    @RequestMapping("sys/user/collection/delete")
    public R deleteUserAttention(String collectionId, String textId){
        userTextCollectionService.updateUserTextCollectionSatate(collectionId,textId);
        log.debug("【"+collectionId+" 取消收藏文章 "+textId+"】");
        return R.ok();
    }
}
